package homework;
class Base2{
	public int a = 1;
	public int b = 2;
	public int d = 99;
	public void func1() {
		System.out.println("func1()");
	}
}
class Derived extends Base2 {
	public int c = 3;
	public int a = 4;
	public void func2() {
		System.out.println("func2()");
	}
	public void func1(int a) {
		System.out.println("func1(int)");
	}
	public void func1() {
		System.out.println("func1(int)");
	}
	public  void testFunc() {
		func2();
		func1(10);//子类的   重载！！
		func1();//子类的
		super.func1();//子类的
	}
	public void method() {
		//同名成员a，子类中a=4，父类中a=1
		//子类和父类中同名的有a，父类中有b=2，d=99，子类中有c=3
		System.out.println(super.a);//父类的a
		System.out.println(this.a);//子类的a
		System.out.println(this.b);//父类中的b
		System.out.println(this.c);//子类中的c
		System.out.println(this.d);//父类中的d
		System.out.println("=================");
		System.out.println(super.a);//父类中的a
		System.out.println(super.b);//父类中的b
		System.out.println(super.d);//父类中的d
		System.out.println("========================");
		System.out.println(this.a);//子类的a
		System.out.println(this.b);//父类中的b
		System.out.println(this.d);//父类中的的
		System.out.println(this.c);//子类中的c

	}
}
public class test4 {
	public static void main(String[] args) {
		Derived derived = new Derived();
		derived.testFunc();
		derived.method();
	}
}
